#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTcpSocket>
#include "speech/audio.h"
#include "speech/speech.h"
#include <QTimer>


namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void slotTimeout(); //定时器到期函数

    void slotReadData();

    void slotConnectError(QAbstractSocket::SocketError socketError);    //连接失败槽函数

    void slotConnectSuccess();       //连接成功槽函数

    void on_pushButton_login_clicked();

    void on_pushButton_led_clicked();

    void LED_clicked_on(QPushButton *button);

    void LED_clicked_off(QPushButton *button);

    void on_pushButton_LED_1_clicked();

    void on_pushButton_LED_2_clicked();

    void on_pushButton_LED_3_clicked();

    void on_pushButton_LED_4_clicked();

    void on_pushButton_LED_all_clicked();

    void on_pushButton_voice_released();

    void on_pushButton_voice_pressed();

    void on_pushButton_music_clicked();

    void on_pushButton_keyboard_clicked();

    void on_pushButton_Do_pressed();

    void on_pushButton_Do_released();

    void on_pushButton_re_pressed();

    void on_pushButton_re_released();

    void on_pushButton_mi_pressed();

    void on_pushButton_mi_released();

    void on_pushButton_fa_pressed();

    void on_pushButton_fa_released();

    void on_pushButton_sol_pressed();

    void on_pushButton_sol_released();

    void on_pushButton_la_pressed();

    void on_pushButton_la_released();

    void on_pushButton_si_pressed();

    void on_pushButton_si_released();

    void on_pushButton_clicked();

    void on_pushButton_tem_clicked();

private:
    Ui::MainWindow *ui;     // 客户端用于通信的fd
    QTcpSocket *sockfd;
    audio *aud;
    speech *sp;

    bool led;

    QTimer *timer; //定时器
    bool leds[5]={0};
};

#endif // MAINWINDOW_H
